ccR.Add_Rotation(
		1,
		"CDM_Paladin_Holy",
		"CDMichealB's fantastic healing.",
		"CDM_Paladin_Holy_Talents",
		"CDM_Paladin_Holy_Abilities",
		"CDM_Paladin_Holy_Features",
		"CDM_Paladin_Holy_Setup"
)

	local LoDCount = {};	local HRCount = {};	local AoECount = {};	local AutoMoveCount = {};	local WildCount = {};	local ClusterCount = {};	local ClusterPreCount = {};	local GenesisCount = {}
	onlyPlayers = true;	local BossTarget = nil;	local TrashTarget = nil;	local LowestHP = nil;	local SecondLowestHP = nil;	local Tank1 = nil;	local Tank2 = nil;	local vUnit = nil;	local RejShroom = nil
	local LifeShroom = nil;	local foundLifeBloom = nil;	local BossTarget = nil;	local TrashTarget = nil;	local HRCount = {};	local HRTarg = nil;	local AoECount = {};	local AoETarg = nil;	local LoDCount = {}
	local HighestTank = nil;	local LowestTank = nil;	local lastEF = GetTime(); local lastLOD = GetTime();	local LowestEF = nil;	local SecondLowestEF = nil;	local LowestGW = nil;	local SecondLowestGW = nil;
	----Highmaul
	--Kargath Bladefist
	local KA_IMPALE = 159113 
	--The Butcher
	local BU_CLEAVE = 156157;	local BU_GUSHING_WOUNDS = 156152
	--Tectus
	local TE_TECTONIC_UPHEAVAL = 162475
	--Brackenspore
	local BR_INFESTING_SPORES = 163242;	local BR_LIVING_SPORES = 159463;	local BR_DECAY = 160013;	local BR_NECROTIC_BREATH = 159220;	local BR_GREEN_WITHERING = 160399;	local BR_GREEN_WITHERING_FAST = 163113
	local BR_BLUE_WITHERING = 163122;	local BR_BLUE_WITHERING_FAST = 163124
	--Twin Orgron
	local OR_INTERRUPTING_SHOUT = 158102
	--Ko'ragh
	local KO_EXPEL_MAGIC_SHADOW = 162184;	local KO_EXPEL_MAGIC_FIRE = 162185;	local KO_EXPEL_MAGIC_FROST = 172747;	local KO_EXPEL_MAGIC_ARCANE = 162186;	local KO_CAUSTIC_ENERGY = 161242;	local KO_SUPPRESSION_FIELD = 161328
	----Blackrock Foundry
	--Gruul
	local GR_INFERNO_SLICE = 155080;	local GR_OVERHEAD_SMASH = 155301; local GR_OVERHWELMING_BLOWS = 155078;	local GR_PETRIFYING_SLAM = 155326;	local GR_DESTRUCTIVE_RAMPAGE = 155539; local GR_CAVE_IN = 155080;
	--Oregorger
	local OR_ACID_TORRENT = 156240;	local OR_ACID_MAW = 173471;	local OR_RETCHED_BLACKROCK = 156203;	local OR_EXPLOSIVE_SHARD = 156390;	local OR_BLACKROCK_BARRAGE = 156877; local OR_HUNGER_DRIVE = 155819;	local OR_ROLLING_FURY = 155898;
	--Beastlord Darmac
	local BL_REND_AND_TEAR = 155061; local BL_SAVAGE_HOWL = 155198;	local BL_SEARED_FLESH = 155030; local BL_INFERNO_BREATH = 154989;	local BL_CONFLAGARATION = 154981; local BL_SUPERHEATED_SHRAPNEL = 155499; local BL_CALL_THE_PACK = 154975
	local BL_FLAME_INFUSION = 155657;	local BL_CRUSH_ARMOR = 155236;	local BL_TANTRUM = 155222;	local BL_STAMPEDE = 155247;	local BL_CANNONBALL_BARRAGE = 155284;	local BL_EPICENTER = 159044; local BL_PINNED_DOWN = 154960
	--Flamebender Ka'graz
	local FL_DEVASTATING_SLAM = 156018;	local FL_DROP_THE_HAMMER = 156040;
	--Hans'gar and Franzok
	local HA_DISRUPTING_ROAR = 160838;	local HA_SMART_STOMPERS = 162124;	local HA_SKULLCRACKER = 153470;	local HA_CRIPPLING_SUPLEX = 156938;	local HA_SHATTERED_VERTEBRAE = 157139;	local HA_SCORCHING_BURNS = 155818;
	--Operator Thogar
	local OP_IRON_BELLOW = 163753;	local OP_CAUTERIZING_BOLT = 160140;	local OP_DELAYED_SIEGE_BOMB = 159481;	local OP_ENKINDLE = 155921;	local OP_PROTOTYPE_PULSE_GRENADE = 155864;
	--The Blast Furnace
	local BF_REPAIR = 155179;	local BF_BOMB = 155192;	local BF_DEFENSE = 160379;	local BF_PYROCLASM = 156937; local BF_MELT_ARMOR = 175104;	local BF_RUPTURE = 156932;	local BF_SHIELDS_DOWN = 158345;	local BF_FIXATE = 158702;	local BF_CAUTERIZE_WOUNDS = 155186;	local BF_VOLATILE_FIRE = 176121;
	local BF_BLAST = 155209;	local BF_HEAT = 155242;	local BF_MELT = 155223;
	--Kromog
	local KR_RUNE_OF_TREMBLING_EARTH = 173917;	local KR_CALL_OF_THE_MOUNTAIN = 158217;	local KR_WARPED_ARMOR = 156766;	local KR_STONE_BREATH = 156852;	local KR_SLAM = 156704;	local KR_RIPPLING_SMASH = 157592;	local KR_RUNE_OF_CRUSHING_EARTH = 161839;
	local KR_RUNE_OF_GRASPING_EARTH = 157060; local KR_THUNDERING_BLOWS = 157054;	local KR_FRENZY = 156861;
	--The Iron Maidens
	local IM_CORRUPTED_BLOOD = 158683;	local IM_RAPID_FIRE = 156626;	local IM_PENETRATING_SHOT = 164271;	local IM_DEPLOY_TURRET = 158599;	local IM_BLADE_DASH = 155794;	local IM_CONVULSIVE_SHADOWS = 156109; local IM_DARK_HUNT = 158315;
	local IM_BLOOD_RITUAL = 159724;	local IM_BLOODSOAKED_HEARTSEEKER = 158010;	local IM_SANGUINE_STRIKES = 156601;	local IM_IRON_WILL = 159336;
	--Blackhand
	local BH_IMPALING_THROW = 175013; local BH_MASSIVE_SHATTERING_SMASH = 176447; BH_SHATTERING_SMASH = 168766;

	--Pally Spells
	local DAYBREAK = 88819;
	local FREEWOG = 166780;
	local FREELOD = 166781;
	local DENOUNCE = 2812;
function CDM_Paladin_Holy()
	--Declarations
	table.wipe(LoDCount);	table.wipe(HRCount);	table.wipe(AoECount)
	LowestHP = "player";	SecondLowestHP = "player";	LowestEF = "player";	SecondLowestEF = "player";	LowestGW = "player";	SecondLowestGW = "player"
	Tank1 = nil;	Tank2 = nil
	HRTarg = nil;	AoETarg = nil
	RejShroom = nil;	LifeShroom = nil
	BossTarget = nil;	TrashTarget = nil
	HighestTank = nil;	LowestTank = nil
	onlyPlayers = ccR.Var("OnlyPlayers")

	if not ccR.Unit.Exists(Tank1) or not ccR.Unit.Is.Tank(vUnit) then
		Tank1 = nil
	end
	if not ccR.Unit.Exists(Tank2) or not ccR.Unit.Is.Tank(vUnit) then
		Tank2 = nil
	end
--End declarations
	if not ccR.Unit.Has.MyBuff(LastFaith, BEACON_OF_FAITH) then
		LastFaith = nil
	end
	for i = 1, # ccR_Friendly do 
		local vUnit = ccR_Friendly[i]
		if ValidToHeal(vUnit, true) and ccR.Unit.Distance(vUnit, "player") <= 50 and (ccR.Unit.Is.APlayer(vUnit) or onlyPlayers == false or ccR.Unit.Name(vUnit) == "Rejuvenating Mushroom" or ccR.Unit.Name(vUnit) == "Living Mushroom") then
			if  ccR.Unit.Name(vUnit) == "Rejuvenating Mushroom" then
				RejShroom = vUnit
			end
			if ccR.Unit.Name(vUnit) == "Living Mushroom" then
				LifeShroom = vUnit
			end
			--Tanks
			if ccR.Unit.Is.APlayer(vUnit) and (Tank1 == nil or Tank2 == nil) then
				if ccR.Unit.Is.Tank(vUnit) and Tank1 == nil then
					Tank1 = vUnit
				elseif ccR.Unit.Is.Tank(vUnit) and Tank2 == nil then
					Tank2 = vUnit
				end
			end
			if Tank1 == nil and ccR.Unit.Exists("Oto The Protector") then
				Tank1 = "Oto The Protector"
			end
			if ValidToHeal(vUnit) and not ccR.Unit.Has.Debuff(vUnit, BR_NECROTIC_BREATH) and ccR.Unit.Name(vUnit) ~= "Living Mushroom" then
				--Lowest HP
				if ccR.Unit.Health(vUnit) < ccR.Unit.Health(LowestHP) then
					SecondLowestHP = LowestHP
					LowestHP = vUnit
				elseif ccR.Unit.Health(vUnit) == ccR.Unit.Health(LowestHP) then
					if UnitHealthMax(vUnit) < UnitHealthMax(LowestHP) then
						SecondLowestHP = LowestHP
						LowestHP = vUnit
					else
						SecondLowestHP = vUnit
					end
				end
				--Lowest HP+NoEF
				if (not ccR.Unit.Has.MyBuff(fUnit, ETERNAL_FLAME) or ccR.Unit.MyBuffDuration(fUnit, ETERNAL_FLAME, "<", 2)) then
					if ccR.Unit.Health(vUnit) < ccR.Unit.Health(LowestEF) then
						SecondLowestEF = LowestEF
						LowestEF = vUnit
					elseif ccR.Unit.Health(vUnit) == ccR.Unit.Health(LowestEF) then
						if UnitHealthMax(vUnit) < UnitHealthMax(LowestEF) then
							SecondLowestEF = LowestEF
							LowestEF = vUnit
						else
							SecondLowestEF = vUnit
						end
					end
				end
				--Lowest NoEF+BU_GUSHING_WOUNDS
				if (ccR.Unit.Has.Debuff(vUnit, BU_GUSHING_WOUNDS) or ccR.Unit.Has.Debuff(vUnit, KO_EXPEL_MAGIC_SHADOW) or ccR.Unit.Has.Debuff(vUnit, KO_CAUSTIC_ENERGY) or ccR.Unit.Has.Debuff(vUnit, IM_DARK_HUNT) or ccR.Unit.Has.Debuff(vUnit, KR_RUNE_OF_GRASPING_EARTH) or ccR.Unit.Has.Debuff(vUnit, BL_PINNED_DOWN) or ccR.Unit.Has.Debuff(vUnit, OR_ACID_TORRENT) or ccR.Unit.Has.Debuff(vUnit, BH_IMPALING_THROW)) and (not ccR.Unit.Has.MyBuff(fUnit, ETERNAL_FLAME) or ccR.Unit.MyBuffDuration(fUnit, ETERNAL_FLAME, "<", 2)) then
					if ccR.Unit.Health(vUnit) < ccR.Unit.Health(LowestGW) then
						SecondLowestGW = LowestGW
						LowestGW = vUnit
					elseif ccR.Unit.Health(vUnit) == ccR.Unit.Health(LowestGW) then
						if UnitHealthMax(vUnit) < UnitHealthMax(LowestGW) then
							SecondLowestGW = LowestGW
							LowestGW = vUnit
						else
							SecondLowestGW = vUnit
						end
					end
				end
				--Counts
				if (ccR.Unit.Health(vUnit) < 86 or (ccR.Unit.Has.Debuff(vUnit, 145263) and ccR.Unit.Health(vUnit) < 86 ) or ccR.Unit.Has.Debuff(vUnit, 162184)) and ccR.Unit.Distance(vUnit, "player") <= 30 then
					LoDCount[#LoDCount+1] = vUnit
				end

				if not AoeTarg then
					for f = 1, # ccR_Friendly do
						local vvvUnit = ccR_Friendly[f]
						if ccR.Unit.Distance(vvvUnit, vUnit) <= 10 and (ccR.Unit.Health(vvvUnit) < 94 or (ccR.Unit.Has.Debuff(vUnit, 145263) and ccR.Unit.Health(vUnit) < 100 )) and (ccR.Unit.Is.APlayer(vUnit) or onlyPlayers == false) then
							AoECount[#AoECount+1] = vvvUnit
						end 
					end
					if # AoECount >= 4 then
						AoETarg = vUnit
					else
						table.wipe(AoECount)
					end
				end
				if ccR.Unit.Exists("Oto The Protector") then
					ccR.Paladin.Feature.Cleanse(vUnit)
					ccR.Paladin.Feature.Rebuke(3)
				end
			end
		end
	end
--debug code
if ccR.Spell.Is.Usable(HOLY_RADIANCE) and not ccR.Var("HealGreenShroom") then
	HRCount, HRTarg = FindCluster(ccR_Friendly, 40, 10)
end
--end debug code


	if Tank1 and Tank2 and ccR.Unit.Health(Tank1) <= ccR.Unit.Health(Tank2) then
		LowestTank = Tank1
		HighestTank = Tank2
	elseif Tank1 and Tank2 and ccR.Unit.Health(Tank2) <= ccR.Unit.Health(Tank1) then
		LowestTank = Tank2
		HighestTank = Tank1
	elseif Tank1 then
		LowestTank = Tank1
	elseif Tank2 then
		LowestTank = Tank2
	end
	if ccR.Spell.Is.Usable(498) and (ccR.Unit.Debuff.Stacks("player", 163242) >= 5 or ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) >= 2) then
		ccR.Cast.Spell(498)
	end
	AutoDivineShield()
	--ccR.Paladin.Feature.Rebuke(3)
	if ccR.Player.IsInCombat() and ccR.Spell.Is.Ready(ARCANE_TORRENT) and ccR.Player.Holy_Power() < 5 then
		ccR.Cast.Spell(ARCANE_TORRENT)
	end
	local startB, _, enableB = GetInventoryItemCooldown("player", 14)
	if ccR.Player.Mana() < 93 and enableB == 1 and startB == 0 then
		UseInventoryItem(14)
	end
	--if Tank1 and (ValidToHeal(Tank1) or not DoHeal(Tank1)) and ccR.Spell.Is.Ready(HAND_OF_SACRIFICE) and not ccR.Unit.Has.MyBuff(Tank1, HAND_OF_SACRIFICE) and ccR.Unit.Health(Tank1) < 50 then
	--	ccR.Cast.Spell(HAND_OF_SACRIFICE, Tank1)
	--elseif Tank2 and (ValidToHeal(Tank2) or not DoHeal(Tank2)) and ccR.Spell.Is.Ready(HAND_OF_SACRIFICE) and not ccR.Unit.Has.MyBuff(Tank1, HAND_OF_SACRIFICE) and ccR.Unit.Health(Tank1) < 50 then
	--	ccR.Cast.Spell(HAND_OF_SACRIFICE, Tank2)
	--elseif RejShroom and ValidToHeal(RejShroom) and ccR.Spell.Is.Ready(HAND_OF_SACRIFICE) and not ccR.Unit.Has.MyBuff(RejShroom, HAND_OF_SACRIFICE) and ccR.Unit.Has.Debuff(RejShroom, 163124) and ccR.Unit.Health(RejShroom) < 50 then
	--	ccR.Cast.Spell(HAND_OF_SACRIFICE, RejShroom)
	--end

	if ccR.Spell.Charges(SACRED_SHIELD_HOLY) >= 1 and ccR.Player.Has.Talent(SACRED_SHIELD_HOLY) then
		if LowestTank then SacredShield(LowestTank) end
		if HighestTank then SacredShield(HighestTank) end
		--if RejShroom then 
		--	SacredShield(RejShroom)
		--elseif LifeShroom then
		--	SacredShield(LifeShroom)
		--else
			SacredShield("player")
		--end
		if Tank1 and not ccR.Unit.Is.Alive(Tank1) then
			SacredShield(LowestHP)
		end
		if Tank2 and not ccR.Unit.Is.Alive(Tank2) then
			SacredShield(LowestHP)
		end
	end
	FindThreat()
	HolyShock(LowestHP, 10)
	ChooseHeal(LowestTank, 10, 2)
	--ChooseHeal(LowestHP, 10, 2)
	-- if (ccR.Unit.Has.Debuff(LowestHP, 145263) and ccR.Unit.Health(LowestHP) < 100 ) then
	-- 	EternalFlame(LowestHP, 100, 3)
	-- 	HolyShock(LowestHP, 100)
	-- 	ChooseHeal(LowestHP, 100)
	-- 	WordOfGlory(LowestHP, 100, 3)
	-- end
	LightOfDawn(5, 4)
	ChooseHeal(LowestHP, 10, 2)
	--if # LoDCount < 4 then
	if ccR.Player.Has.Talent(ETERNAL_FLAME) then
		EternalFlame("player", 70, 5)
		EternalFlame(BossTarget, 101, 5)
		EternalFlame(LowestTank, 101, 5)
		EternalFlame(HighestTank, 101, 5)
		EternalFlame("player", 101, 5)
		EternalFlame(LowestHP, 90, 5)
	end
		--BlanketEternalFlame(93, 5)
		--BlanketEternalFlame(101, 3, true)
		--WordOfGlory(LowestHP, 90, 5)
	--end
	-- if ccR.Var("HealBlueShroom") and RejShroom then
	-- 	if #LoDCount <= 3 then WordOfGlory(RejShroom, 101, 5) end
	-- 	HolyShock(RejShroom, 101)
	-- end
	if ccR.Player.Has.Talent(ETERNAL_FLAME) and ccR.Player.Holy_Power() >= 5 then
		BlanketEternalFlame(101, 3, true)
	end
	if ccR.Player.Has.Buff(INFUSION_OF_LIGHT) then
		if ccR.Unit.Health(LowestTank) <= ccR.Unit.Health(BossTarget) then
			HolyLight(LowestTank, 95, 2)
		elseif ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestHP) then
			HolyLight(BossTarget, 101, 2)
		else
			HolyLight(LowestHP, 101, 2)
		end
	end

	if ccR.Unit.Health(LowestTank) <= ccR.Unit.Health(LowestHP) then
		HolyShock(LowestTank, 90)
	elseif ccR.Unit.Health(LowestHP) <= ccR.Unit.Health(BossTarget) then
		HolyShock(LowestHP, 90)
	elseif ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestTank) then
		HolyShock(BossTarget, 101)
	end
		HolyShock(LowestTank, 101)
	--end
	if ccR.Player.Has.Talent(ETERNAL_FLAME) then
		if ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestTank) then
			EternalFlame(BossTarget, 101, 3)
		elseif ccR.Unit.Health(LowestTank) <= ccR.Unit.Health(HighestTank) then
			EternalFlame(LowestTank, 101, 3)
		end
			EternalFlame(HighestTank, 101, 3)
	end
	-- if ccR.Unit.Exists("Oto The Protector") then
	-- 	EternalFlame(LowestHP, 101, 4)
	-- end
	-- if RejShroom then
	-- 	EternalFlame(RejShroom, 101, 3)
	-- end
	if ccR.Var("EnableDPS") then
		ChooseHeal(LowestTank, 50, 2)
		if ccR.Unit.Exists("target") and ccR.Target.Is.Attackable() and ccR.Player.Is.Facing("target") and ccR.Spell.Is.Ready(DENOUNCE) and ccR.Spell.CanAttack(DENOUNCE, "target") then
			ccR.Cast.Attack(DENOUNCE, "target")
		end
	end
	ChooseHeal(LowestTank, 80, 2)
	if ccR.Unit.Health(TrashTarget) >= 95 and ccR.Unit.Health(BossTarget) >= 100 and ccR.Unit.Health(LowestTank) >= 95 then
		ChooseHeal(LowestHP, 90, 2)
	end
	--ChooseHeal(HighestTank, 60, 2)
	if ccR.Player.Has.Buff(INFUSION_OF_LIGHT) then
		if ccR.Unit.Health(LowestTank) <= ccR.Unit.Health(BossTarget) then
			HolyLight(LowestTank, 95, 2)
		elseif ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestHP) then
			HolyLight(BossTarget, 101, 2)
		else
			HolyLight(LowestHP, 101, 2)
		end
	end
	LightOfDawn(6, 6)
	if ccR.Player.Has.Buff(HOLY_AVENGER) then
		LightOfDawn(4, 5)
		if ccR.Player.Has.Talent(ETERNAL_FLAME) and ccR.Player.Has.Buff(HOLY_AVENGER) then
			EternalFlame(LowestHP, 90, 5)
			EternalFlame(LowestHP, 80, 4)
			EternalFlame(LowestHP, 70, 3)
			EternalFlame(LowestEF, 90, 5)
		end
		if # LoDCount < 5 then
			--WordOfGlory(LowestTank, 90, 4)
			--WordOfGlory(HighestTank, 90, 4)
			--WordOfGlory(LowestHP, 90, 4)
			LightOfDawn(4, 4)
		elseif # LoDCount <= 3 and ccR.Player.Has.Talent(ETERNAL_FLAME) then
			EternalFlame(BossTarget, 101, 5)
			EternalFlame(LowestTank, 101, 5)
			EternalFlame(HighestTank, 101, 5)
			EternalFlame(LowestHP, 101, 5)
			--WordOfGlory(LowestTank, 101, 5)
			--WordOfGlory(HighestTank, 101, 5)
			--WordOfGlory(LowestHP, 101, 5)
		end
	end
	if ccR.Player.Has.Buff(HOLY_AVENGER) and ccR.Player.Holy_Power() <= 2 then
		AutoCrusader()
	end
	if ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestTank) then
		ChooseHeal(BossTarget, 75, 2)
	else
		ChooseHeal(LowestTank, 75, 2)
	end
	--ChooseHeal(HighestTank, 75, 2)
	ChooseHeal(LowestHP, 50, 2)
	HolyRadiance(HRTarg, 6)
	LightOfDawn(3, 6)
	--if ccR.Unit.Exists("Oto The Protector") then
	--	--HolyRadiance(HRTarg, 5)
		--LightOfDawn(3, 5)
	--end
	--EternalFlame(LowestHP, 85, 3)
	if ccR.Player.Has.Talent(ETERNAL_FLAME) and Tank1 and Tank2 and ccR.Unit.Has.MyBuff(Tank1, ETERNAL_FLAME) and ccR.Unit.Has.MyBuff(Tank2, ETERNAL_FLAME) then
		BlanketEternalFlame(80, 3)
	end
	-- if LifeShroom then
	-- 	if ccR.Unit.Has.Debuff("player", BR_INFESTING_SPORES) and not ccR.Unit.Has.Debuff(LifeShroom, BR_GREEN_WITHERING) and not ccR.Unit.Has.Debuff(LifeShroom, BR_GREEN_WITHERING_FAST) then
	-- 		if # LoDCount < 4 and not ccR.Player.Has.Buff(INFUSION_OF_LIGHT) then
	-- 			WordOfGlory(LifeShroom, 101, 3)
	-- 		end
	-- 		ChooseHeal(LifeShroom, 101)
	-- 	end
	-- 	if ccR.Var("HealGreenShroom") then
	-- 		ChooseHeal(LifeShroom, 30)
	-- 		HolyLight(LifeShroom, 101)
	-- 	end
	-- end
	-- if ccR.Var("HealBlueShroom") and RejShroom then
	-- 	ChooseHeal(RejShroom, 30)
	-- end
	--if ccR.Unit.Exists("Oto The Protector") then
		--ChooseHeal(LowestHP, 80, 90)
		--ChooseHeal(SecondLowestHP, 80, 90)
		--HolyLight(LowestHP, 45, 85)
		--HolyLight(SecondLowestHP, 45, 85)
		-- if ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestTank) then
		-- 	HolyLight(BossTarget, 65, 2)
		-- else
		-- 	HolyLight(LowestTank, 65, 2)
		-- end
		-- if ccR.Unit.Health(Tank1) <= ccR.Unit.Health(Tank2) then
		-- 	HolyLight(Tank1, 65, 2)
		-- else
		-- 	HolyLight(Tank2, 65, 2)
		-- end
		--HolyLight(LowestHP, 35, 75)
		--HolyLight(SecondLowestHP, 35, 75)
		ChooseHeal(LowestHP, 15, 2)
		ChooseHeal(SecondLowestHP, 15, 2)
	--end

	-- if ccR.Var("HealBlueShroom") and RejShroom then
	-- 	if # LoDCount < 4 and not ccR.Player.Has.Buff(INFUSION_OF_LIGHT) then
	-- 		WordOfGlory(RejShroom, 101, 3)
	-- 	end
	-- 	ChooseHeal(RejShroom, 101)
	-- end
	-- if # LoDCount < 4 then
	-- 	--WordOfGlory(LowestHP, 10, 3)
	-- end
	--HolyLight(LowestHP, 40, 2)
	--HolyLight(SecondLowestHP, 40, 2)
	if ccR.Player.Has.Talent(ETERNAL_FLAME) and Tank1 and Tank2 and ccR.Unit.Has.MyBuff(Tank1, ETERNAL_FLAME) and ccR.Unit.Has.MyBuff(Tank2, ETERNAL_FLAME) then
		EternalFlame(LowestHP, 30, 3)
		EternalFlame(LowestHP, 20, 2)
		EternalFlame(LowestHP, 10, 1)
		BlanketEternalFlame(90, 3)
	end
	--HolyLight(BossTarget, 70, 2)
	--HolyLight(LowestTank, 70, 2)
	--HolyLight(HighestTank, 70, 2)

	HolyRadiance(HRTarg, 5)
	if ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestTank) then
		HolyLight(BossTarget, 80, 2)
	else
		HolyLight(LowestTank, 80, 2)
	end
	--HolyLight(HighestTank, 80, 2)
	if ccR.Player.Holy_Power() == 5 then
		if ccR.Player.Has.Talent(ETERNAL_FLAME) then
			BlanketEternalFlame(101, 5)
			EternalFlame(LowestTank, 90, 5)
			if BossTarget and TrashTarget and ccR.Unit.MyBuffDuration(BossTarget, ETERNAL_FLAME) < ccR.Unit.MyBuffDuration(TrashTarget, ETERNAL_FLAME) then
				WordOfGlory(BossTarget, 101, 5)
			elseif BossTarget and TrashTarget and ccR.Unit.MyBuffDuration(BossTarget, ETERNAL_FLAME) >= ccR.Unit.MyBuffDuration(TrashTarget, ETERNAL_FLAME) then
				WordOfGlory(TrashTarget, 101, 5)
			end
		end
		if BossTarget and TrashTarget and ccR.Unit.MyBuffDuration(BossTarget, ETERNAL_FLAME) < ccR.Unit.MyBuffDuration(TrashTarget, ETERNAL_FLAME) then
			WordOfGlory(BossTarget, 101, 5)
		elseif BossTarget and TrashTarget and ccR.Unit.MyBuffDuration(BossTarget, ETERNAL_FLAME) >= ccR.Unit.MyBuffDuration(TrashTarget, ETERNAL_FLAME) then
			WordOfGlory(TrashTarget, 101, 5)
		end
		if ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(TrashTarget) then
			WordOfGlory(BossTarget, 90)
		elseif ccR.Unit.Health(TrashTarget) <= ccR.Unit.Health(LowestHP) then
			WordOfGlory(TrashTarget,  90)
		elseif ccR.Unit.Health(LowestTank) <= ccR.Unit.Health(LowestHP) then
			WordOfGlory(LowestTank, 90)
		else
			WordOfGlory(LowestHP, 90)
		end
		LightOfDawn(5, 0)
	end

	AutoCrusader()
	
	if ccR.Unit.Health(TrashTarget) <= ccR.Unit.Health(LowestHP) then
		HolyShock(TrashTarget, 90)
	elseif ccR.Unit.Health(LowestHP) <= ccR.Unit.Health(BossTarget) then
		HolyShock(LowestHP,  90)
	elseif ccR.Unit.Health(BossTarget) <= ccR.Unit.Health(LowestTank) then
		HolyShock(BossTarget, 101)
	end
	HolyShock(LowestTank, 101)
	AutoDenounce()
	--HolyShock(HighestTank, 101)
	if ccR.Unit.Health(TrashTarget) >= 95 and ccR.Unit.Health(BossTarget) >= 100 and ccR.Unit.Health(LowestTank) >= 95 then
		ChooseHeal(LowestHP, 90, 2)
		
	end
	ChooseHeal(LowestHP, 30, 2)
	HolyLight(TrashTarget, 90, 2)
	ChooseHeal(LowestHP, 65, 2)
	HolyLight(BossTarget, 101, 2)
	HolyLight(LowestTank, 101, 2)

end


function ChooseHeal(fUnit, fHealth, fMana, fWoG)
	--fUnit = fUnit or "player"
	fHealth = fHealth or 100
	fMana = fMana or 0
	fWoG = fWoG or false
	if not IsMoving() and ccR.Spell.CastTime(FLASH_OF_LIGHT) < ccR.Spell.CastTime(HOLY_LIGHT) then
		
		if fWoG then
			EternalFlame(fUnit, fHealth, 3)
			WordOfGlory(fUnit, fHealth, 5)
		end
		FlashOfLight(fUnit, fHealth, fMana)
	elseif not IsMoving() then
		HolyLight(fUnit, fHealth, fMana)
	end
end
function HolyLight(fUnit, fHealth, fMana)
	--fUnit = fUnit or "player"
	fHealth = fHealth or 100
	fMana = fMana or 0
	if not IsMoving() and ccR.Spell.Is.Ready(HOLY_LIGHT) and ValidToHeal(fUnit) and ccR.Unit.Health(fUnit) < fHealth and ccR.Player.Mana() > fMana then
		ccR.Cast.Spell(HOLY_LIGHT, fUnit)
		lastEF = 0; lastLOD = 0
	end
end
function FlashOfLight(fUnit, fHealth, fMana)
	--fUnit = fUnit or "player"
	fHealth = fHealth or 100
	fMana = fMana or 0
	if not IsMoving() and ccR.Spell.Is.Ready(FLASH_OF_LIGHT) and ValidToHeal(fUnit) and ccR.Unit.Health(fUnit) < fHealth and ccR.Player.Mana() > fMana then
		ccR.Cast.Spell(FLASH_OF_LIGHT, fUnit)
		lastEF = 0; lastLOD = 0
	end
end
function WordOfGlory(fUnit, fHealth, fHolyPower)
	--fUnit = fUnit or "player"
	fHealth = fHealth or 100
	fHolyPower = fHolyPower or 1
	if ccR.Player.Has.Buff(86172) or ccR.Player.Has.Buff(FREEWOG) then fHolyPower = 0 end
	if not IsMoving() and ValidToHeal(fUnit) and GetTime()-lastEF >= ccR.Spell.CastTime(ETERNAL_FLAME)+0.1 and ccR.Unit.Health(fUnit) < fHealth and ccR.Player.Holy_Power() >= fHolyPower then
		if ccR.Player.Has.Talent(ETERNAL_FLAME) and ccR.Spell.Is.Ready(ETERNAL_FLAME)then
			ccR.Cast.Spell(ETERNAL_FLAME, fUnit)
			lastEF = GetTime()
			lastLOD = 0
		elseif ccR.Spell.Is.Ready(WORD_OF_GLORY) then
			ccR.Cast.Spell(WORD_OF_GLORY, fUnit)
			lastEF = GetTime()
			lastLOD = 0
		end
	end
	
end


function EternalFlame(fUnit, fHealth, fHolyPower)
	--fUnit = fUnit or "player"
	if not ccR.Player.Has.Talent(ETERNAL_FLAME) then
		--WordOfGlory(fUnit, fHealth, fHolyPower)
		return
	end
	fHealth = fHealth or 100
	fHolyPower = fHolyPower or 1
	if ccR.Player.Has.Buff(86172) or ccR.Player.Has.Buff(FREEWOG) then fHolyPower = 0 end
	if fUnit then
		_, _, _, _, _, EFDuration = UnitAura(fUnit,ETERNAL_FLAME)
	end
	if EFDuration == nil then EFDuration = 10 end
	if ccR.Unit.Has.Debuff(fUnit, KO_EXPEL_MAGIC_SHADOW) then fHealth = 101 end
	if not IsMoving() and ccR.Player.Has.Talent(ETERNAL_FLAME) and GetTime()-lastEF >= ccR.Spell.CastTime(ETERNAL_FLAME)+0.1 and ccR.Spell.Is.Ready(ETERNAL_FLAME) and ValidToHeal(fUnit) and ccR.Unit.Health(fUnit) < fHealth and ccR.Player.Holy_Power() >= fHolyPower and (not ccR.Unit.Has.MyBuff(fUnit, ETERNAL_FLAME) or ccR.Unit.MyBuffDuration(fUnit, ETERNAL_FLAME, "<", (EFDuration * 0.2) + ccR.Spell.CastTime(ETERNAL_FLAME))) then
		ccR.Cast.Spell(ETERNAL_FLAME, fUnit)
		lastEF = GetTime()
		lastLOD = 0
	--ccR.PrintToChat("a " .. EFDuration)
	--ccR.PrintToChat("b " .. EFDuration * 0.2)
	end
	EFDuration = nil
end
function LightOfDawn(fHolyPower, fCount)
	 fHolyPower = fHolyPower or 1
	 fCount = fCount or 6
	 if ccR.Player.Has.Glyph(54940) and fCount >= 5 then fCount = 4 end
	 --fHolyPower = 6
	 if ccR.Player.Has.Buff(FREELOD) then fHolyPower = 0 end
	 if ccR.Player.Has.Buff(FREELOD) and (ccR.Unit.MyBuffDuration("player", FREELOD, "<", ccR.Spell.CastTime(LIGHT_OF_DAWN) + (1.5/(1+GetHaste()*.01)) + 1.05) and ccR.Unit.MyBuffDuration("player", FREELOD, ">", ccR.Spell.CastTime(LIGHT_OF_DAWN))) then fCount = 0 end
	 if not IsMoving() and ccR.Spell.Is.Ready(LIGHT_OF_DAWN) and GetTime()-lastLOD >= ccR.Spell.CastTime(LIGHT_OF_DAWN)+0.1 and #LoDCount >= fCount and ccR.Player.Holy_Power() >= fHolyPower then
	 	ccR.Cast.Spell(LIGHT_OF_DAWN)
	 	lastLOD = GetTime()
	 	lastEF = 0;
	 end
end
function HolyShock(fUnit, fHealth)
	fUnit = fUnit or "player"
	fHealth = fHealth or 100
	if ccR.Spell.Is.Ready(HOLY_SHOCK) and ccR.Player.Holy_Power() < 5 and ccR.Player.Has.Buff(DAYBREAK) and (ValidToHeal(fUnit) and ccR.Unit.Health(fUnit) >= 5) and ValidToHeal(AoETarg) and # AoECount >= 4 then
		ccR.Cast.Spell(HOLY_SHOCK, AoETarg)
		lastEF = 0; lastLOD = 0
	elseif ccR.Spell.Is.Ready(HOLY_SHOCK) and ccR.Player.Holy_Power() < 5 and ValidToHeal(fUnit) and ccR.Unit.Health(fUnit) < fHealth then
		ccR.Cast.Spell(HOLY_SHOCK, fUnit)
		lastEF = 0; lastLOD = 0
	end
end
function HolyRadiance(fUnit, fCount)
	--fUnit = fUnit or "player"
	if ccR.Var("HealGreenShroom") then return end
	fCount = fCount or 6
	if not IsMoving() and ccR.Spell.Is.Ready(HOLY_RADIANCE) and #HRCount >= fCount then
		ccR.Cast.Spell(HOLY_RADIANCE, fUnit)
	end
end
function CrusaderStrike(fHolyPower)
	fHolyPower = fHolyPower or 5

	if ccR.Player.IsInCombat() then
		if ccR.Target.Exists() and ccR.Target.Is.Attackable() then
			ccR.Start_Attack()
			if ccR.Spell.Is.Ready(CRUSADER_STRIKE) and ccR.Player.Holy_Power() < fHolyPower and ccR.Target.Exists() and ccR.Player.Is.Facing("target") then ccR.CastAttack(CRUSADER_STRIKE); lastEF = 0; lastLOD = 0 end
		end
	end
end
function SacredShield(fUnit)
	--fUnit = fUnit or "player"
	if ccR.Player.Has.Talent(SACRED_SHIELD_HOLY) and ccR.Spell.Charges(SACRED_SHIELD_HOLY) >= 1 and ValidToHeal(fUnit) and not ccR.Unit.Has.MyBuff(fUnit, SACRED_SHIELD_HOLY) then
		ccR.Cast.Spell(SACRED_SHIELD_HOLY, fUnit) 
	end
end
function LightsHammer(fCount, fTable)
	fCount = fCount or 5
	if ccR.Spell.Is.Ready(LIGHTS_HAMMER) and # AoECount >= 6 then
		ccR.Cast.Spell(LIGHTS_HAMMER)
		if SpellIsTargeting() then CastAtPosition(GetAveragePositionOfObjects(AoECount)) end
	elseif ccR.Spell.Is.Ready(LIGHTS_HAMMER) and # HRCount >= 6 then
		ccR.Cast.Spell(LIGHTS_HAMMER)
		if SpellIsTargeting() then CastAtPosition(GetAveragePositionOfObjects(HRCount)) end
	elseif ccR.Spell.Is.Ready(LIGHTS_HAMMER) and # AoECount >= 5 then
		ccR.Cast.Spell(LIGHTS_HAMMER)
		if SpellIsTargeting() then CastAtPosition(GetAveragePositionOfObjects(AoECount)) end
	elseif ccR.Spell.Is.Ready(LIGHTS_HAMMER) and # HRCount >= 5 then
		ccR.Cast.Spell(LIGHTS_HAMMER)
		if SpellIsTargeting() then CastAtPosition(GetAveragePositionOfObjects(HRCount)) end
	end
end
function HolyPrism(fUnit, fCount)
	fUnit = fUnit or "target"
	fCount = fCount or 6
end
function ExecutionSentence(fUnit, fHealth, fMana)
	fUnit = fUnit or "player"
	fHealth = fHealth or 100
	fMana = fMana or 0
	if ccR.Spell.Is.Ready(EXECUTION_SENTENCE) and ValidToHeal(fUnit) and ccR.Unit.Health(fUnit) < fHealth and ccR.Player.Mana() > fMana then
		ccR.Cast.Spell(EXECUTION_SENTENCE, fUnit)
	end
end

function ValidToHeal(tunit, ignoreRange)
	if tunit and ccR.Unit.Exists(tunit) and ccR.Unit.Is.Alive(tunit) and ccR.Unit.Is.InLineOfSight(tunit) and DoHeal(tunit) then
		if ignoreRange then
			return true
		elseif ccR.Unit.Distance(tunit, "player") <= 40 then
			return true
		else
			return false
		end
	else
		return false
	end
end

function FindThreat()
		for x = 1, # ccR_Enemies_In_Combat do
			local vUnit = ccR_Enemies_In_Combat[x]
			if ccR.Unit.Is.Alive(vUnit)
			
			and ccR.Unit.Is.Attackable(vUnit)
			
			
			and ccR.Unit.Is.InCombat(vUnit)
			then
				if ccR.Unit.Is.Boss(vUnit) and ccR.Unit.Is.Tank(UnitTarget(vUnit)) then
					BossTarget = UnitTarget(vUnit)
				elseif ccR.Unit.Is.Tank(UnitTarget(vUnit)) then
					TrashUnit = UnitTarget(vUnit)
				end

			end
		end
end

function GetAveragePositionOfObjects (Objects)
	local Total = #Objects;
	local X, Y, Z = 0, 0, 0;
	
	for Key, ThisObject in pairs(Objects) do
		if ThisObject then
			local ThisX, ThisY, ThisZ =  ObjectPosition(ThisObject);
			if ThisX and ThisY then
				X = X + ThisX;
				Y = Y + ThisY;
				Z = Z + ThisZ;
			end
		end
	end

	X = X / Total;
	Y = Y / Total;
	Z = Z / Total;
	return X, Y, Z;
end

function DoHeal(fUnit)
	 if ccR.Unit.Has.Debuff(fUnit, BR_NECROTIC_BREATH) then
	 	return false
	 else
	 	return true
	 end
end

function AutoCrusader()
	if ccR.Unit.Exists("target") and ccR.Player.Holy_Power() < 5 and ccR.Target.Is.Attackable() and ccR.Player.Is.Facing("target") and ccR.Spell.Is.Ready(CRUSADER_STRIKE) and ccR.Spell.CanAttack(CRUSADER_STRIKE, "target") then
		ccR.Cast.Attack(CRUSADER_STRIKE, "target")
	else
		for x = 1, # ccR_Enemies_In_Combat do
			local vUnit = ccR_Enemies_In_Combat[x]
			if ccR.Unit.Is.Alive(vUnit)
			and ccR.Player.Is.Facing(vUnit)
			and ccR.Spell.CanAttack(CRUSADER_STRIKE, vUnit)
			and ccR.Unit.Is.InCombat(vUnit)
			and ccR.Player.Holy_Power() < 5
			then
				ccR.Cast.Attack(CRUSADER_STRIKE, vUnit)
				lastEF = 0; lastLOD = 0
			end
		end
	end
end
function AutoDenounce()
	if ccR.Player.Has.Glyph(56420) and ccR.Unit.Exists("target") and ccR.Spell.CastTime(DENOUNCE) <= 1 and ccR.Target.Is.Attackable() and ccR.Player.Is.Facing("target") and ccR.Spell.Is.Ready(DENOUNCE) and ccR.Spell.CanAttack(DENOUNCE, "target") then
		--ccR.Cast.Attack(DENOUNCE, "target")
	else
		for x = 1, # ccR_Enemies_In_Combat do
			local vUnit = ccR_Enemies_In_Combat[x]
			if ccR.Unit.Is.Alive(vUnit)
			and ccR.Player.Has.Glyph(56420)
			and ccR.Player.Is.Facing(vUnit)
			and ccR.Spell.CanAttack(DENOUNCE, vUnit)
			and ccR.Unit.Is.InCombat(vUnit)
			and ccR.Spell.CastTime(DENOUNCE) <= 1
			then
				--ccR.Cast.Attack(DENOUNCE, vUnit)
				lastEF = 0; lastLOD = 0
			end
		end
	end
end
function AutoDivineShield()
	for x = 1, # ccR_Enemies_In_Combat do
		local vUnit = ccR_Enemies_In_Combat[x]
		if ccR.Unit.Is.Alive(vUnit)
		and (ccR.Spell.Is.Usable(498) or ccR.Spell.Is.Usable(642)) 
		--and ccR.Player.Is.Facing(vUnit)
		and ccR.Unit.Is.InCombat(vUnit)
		--and ccR.Unit.Is.Boss(vUnit)
		then
			if ccR.Spell.Is.Usable(498) and (ccR.Unit.Is.CastingSpell(vUnit, KO_EXPEL_MAGIC_FROST) or ccR.Unit.Is.CastingSpell(vUnit, BL_TANTRUM) or (ccR.Unit.Is.CastingSpell(vUnit, BH_SHATTERING_SMASH) and ccR.Spell.CanAttack(CRUSADER_STRIKE, vUnit))) then
				ccR.Cast.Spell(498)
			end
			if ccR.Player.Has.Talent(114154) and ccR.Spell.Is.Usable(642) and ccR.Unit.Is.CastingSpell(vUnit, KO_EXPEL_MAGIC_SHADOW) then
				ccR.Cast.Spell(642)
			end
		end
	end
end

function FindCluster(fTable, fDistance, fRadius)
	local ClusterCount = {}
	local ClusterPreCount = {}
	local ClusterUnit = nil
	local i = 1
	local f = 1
	local fDistance = fDistance or 40
	local fRadius = fRadius or 10
	if fTable == nil then
		ccR.PrintToChat("Warning table is nil.")
	else
		for i = 1, # fTable do 
			local vUnit = fTable[i]
			table.wipe(ClusterPreCount)

			if (ccR.Unit.Is.APlayer(vUnit) or onlyPlayers == false) 
			and ccR.Unit.Distance(vUnit, "player") <= fDistance 
			and ValidToHeal(vUnit) 
			and not ccR.Unit.Has.Debuff(vUnit, 159220) 
			--and not ((ClearCast() or ccR.Player.Has.Buff(TREE_OF_LIFE)) and ccR.Unit.Name(vUnit) == "Living Mushroom") 
			and ((ccR.Unit.Name(vUnit) == "Living Mushroom" and ccR.Var("HealGreenShroom")) or ccR.Unit.Name(vUnit) ~= "Living Mushroom") 
			and ((ccR.Unit.Name(vUnit) == "Rejuvenating Mushroom" and ccR.Var("HealBlueShroom")) or ccR.Unit.Name(vUnit) ~= "Rejuvenating Mushroom") 
			then
				for f = 1, # fTable do
					local cUnit = fTable[f]
					if ccR.Unit.Distance(cUnit, vUnit) <= fRadius and (ccR.Unit.Health(cUnit) < 88 or (ccR.Unit.Has.Debuff(cUnit, 145263) and ccR.Unit.Health(cUnit) < 88 )) and ccR.Unit.Is.APlayer(cUnit) and ValidToHeal(cUnit) then
						ClusterPreCount[#ClusterPreCount+1] = cUnit
					end 
				end
				if (ClusterPreCount and # ClusterPreCount > # ClusterCount) or ClusterCount == nil then
					table.wipe(ClusterCount)
					ClusterUnit = vUnit
					for f = 1, # fTable do
						local cUnit = fTable[f]
						if ccR.Unit.Distance(cUnit, vUnit) <= fRadius and  (ccR.Unit.Health(cUnit) < 88 or (ccR.Unit.Has.Debuff(cUnit, 145263) and ccR.Unit.Health(cUnit) < 88 )) and ccR.Unit.Is.APlayer(cUnit) and ValidToHeal(cUnit) then
							ClusterCount[#ClusterCount+1] = cUnit
						end 
					end
				end
			end
		end
	end
	return ClusterCount, ClusterUnit
end

function BlanketEternalFlame(fHealth, fHolyPower, fDebuff)
	fDebuff = fDebuff or false
	if ccR.Player.Has.Buff(86172) or ccR.Player.Has.Buff(FREEWOG) then fHolyPower = 0 end

	if ccR.Spell.Is.Ready(ETERNAL_FLAME) and not IsMoving() and fDebuff then
		EternalFlame(LowestTank, 101, 3)
		EternalFlame(HighestTank, 101, 3)
		if ccR.Unit.Has.Debuff("player", BU_GUSHING_WOUNDS) or ccR.Unit.Has.Debuff("player", KO_EXPEL_MAGIC_SHADOW) or ccR.Unit.Has.Debuff("player", KO_CAUSTIC_ENERGY) then EternalFlame("player", 90, 3) end
		-- for i = 1, # ccR_Friendly do 
		-- 	local vUnit = ccR_Friendly[i]
		-- 	if ValidToHeal(vUnit) and DoHeal(vUnit) and ccR.Unit.Has.Debuff(vUnit, BU_GUSHING_WOUNDS) and ccR.Unit.Has.MyBuff(LowestTank, ETERNAL_FLAME) and ccR.Unit.Has.MyBuff(HighestTank, ETERNAL_FLAME) then
		-- 		if ccR.Player.Holy_Power() == 1 and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 3 then
		-- 			EternalFlame(vUnit, 101, 1)
		-- 		elseif ccR.Player.Holy_Power() == 2 and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 2 then
		-- 			EternalFlame(vUnit, 91, 2)
		-- 		elseif ccR.Player.Holy_Power() == 3 and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 1 then
		-- 			EternalFlame(vUnit, 81, 3)
		-- 		elseif ccR.Player.Has.Buff(86172) and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 2 then
		-- 			EternalFlame(vUnit, 91, 0)
		-- 		elseif ccR.Player.Has.Buff(86172) and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 3 then
		-- 			EternalFlame(vUnit, 51, 0)
		-- 		elseif ccR.Player.Has.Buff(86172) and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 2 then
		-- 			EternalFlame(vUnit, 101, 5)
		-- 		elseif ccR.Player.Has.Buff(86172) and ccR.Unit.Debuff.Stacks("player", BU_GUSHING_WOUNDS) <= 3 then
		-- 			EternalFlame(vUnit, 101, 5)
		-- 		elseif not fDebuff then
		-- 			EternalFlame(vUnit, fHealth, fHolyPower)
		-- 		end
		-- 	end
		-- end
		if ccR.Unit.Debuff.Stacks(LowestGW, BU_GUSHING_WOUNDS) == 3 or ccR.Unit.Has.Debuff(LowestGW, KO_EXPEL_MAGIC_SHADOW) or ccR.Unit.Has.Debuff(LowestGW, KO_CAUSTIC_ENERGY)then
			EternalFlame(LowestGW, 87, 1)
		elseif ccR.Unit.Debuff.Stacks(LowestGW, BU_GUSHING_WOUNDS) == 2 or ccR.Unit.Has.Debuff(LowestGW, KO_EXPEL_MAGIC_SHADOW) or ccR.Unit.Has.Debuff(LowestGW, KO_CAUSTIC_ENERGY)then
			EternalFlame(LowestGW, 93, 1)
		elseif ccR.Unit.Debuff.Stacks(LowestGW, BU_GUSHING_WOUNDS) == 1 or ccR.Unit.Has.Debuff(LowestGW, KO_EXPEL_MAGIC_SHADOW) or ccR.Unit.Has.Debuff(LowestGW, KO_CAUSTIC_ENERGY)then
			EternalFlame(LowestGW, 101, 1)
		end
		if ccR.Player.Has.Buff(86172) or ccR.Player.Has.Buff(FREEWOG) then
			EternalFlame(LowestGW, 101, 0)
		end
	elseif ccR.Spell.Is.Ready(ETERNAL_FLAME) and not fDebuff then
		EternalFlame(LowestTank, 101, 3)
		EternalFlame(HighestTank, 101, 3)
		EternalFlame(LowestEF, fHealth, fHolyPower)
	end
end

function IsMoving(fSpell)
	if ccR.Player.Is.Moving() then
		if ccR.Player.Has.Buff(172106) then
			return false
		else
			return true
		end
	else
		return false
	end
end